<!--  -->
<template>
  <div class="coupon-info flex-j-c flex-a-c">
    <div class="coupon-img flex-a-c flex-j-c">
      <img :src="image" />
    </div>
    <h3 class="title ell">{{ dataInfo.name }}</h3>
    <div class="coupon-bgImage"    v-if="dataInfo.coupon_img_url" >
      <img :src="dataInfo.coupon_img_url" />
      <div class="price-text" v-if="dataInfo.coupon_discount_show">
        <h3 class="price" v-if="dataInfo.coupon_method == 1"><span>{{ $i18n.t("money") }}</span>{{ parseFloat(dataInfo.deduct) || '0' }}</h3>
        <h3 class="price" v-if="dataInfo.coupon_method == 2">{{ parseFloat(dataInfo.discount) || '-' }}折</h3>
        <p>满{{ dataInfo.enough }}可用</p>
      </div>
    </div>
    <div class="coupon-pirce" v-else>
      <div class="code-circle"></div>
      <div class="code-circle2"></div>
      <div class="price-bg"></div>
      <div class="circle-hide"></div>
      <div class="circle-hide2"></div>
      <block v-if="dataInfo.coupon_discount_show">
        <h3 class="price" v-if="dataInfo.coupon_method == 1"><span>{{ $i18n.t("money") }}</span>{{ parseFloat(dataInfo.deduct) || '0' }}</h3>
        <h3 class="price" v-if="dataInfo.coupon_method == 2">{{ parseFloat(dataInfo.discount) || '-' }}折</h3>
        <p>满{{ dataInfo.enough }}可用</p>
      </block>
      <div v-else class="discount-box"></div>
    </div>
    <slot name="shareBtn"></slot>
    <slot name="couponBtn"></slot>
    <div class="code-desc">
      <div class="desc-circle"></div>
      <div class="desc-circle2"></div>
      <slot name="desc"></slot>
    </div>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
export default {
  name:'',
  props:{
    dataInfo:{
      type:Object,
      default:() => {
        return {}
      }
    },
    image:String
  },
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
  return {

  };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {

  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {

  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {

  },
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang="scss" scoped>
/* @import url(); 引入公共css类 */
.ell {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  /* 定义显示的行数 */
  overflow: hidden;
}
.coupon-bgImage {
  min-width: 13.8125rem;
  max-width: 90%;
  height: auto;
  position: relative;
  margin:1.25rem 0 1.5625rem 0;
  img {
    max-width: 100%;
    width: 100%;
    height: auto;
  }
  .price-text {
    position: absolute;
    left:50%;
    top:50%;
    transform: translate(-50%,-50%);
    
    .price {
        font-weight: bold;
        color:  var(--themeBaseColor);
        font-size: 1.875rem;
        line-height: 1.875rem;
        span {
          font-size:1.25rem;
        }
        padding:0 0 0.25rem 0;
    }
    p {
      color:  var(--themeBaseColor);
      font-size: 0.75rem;
    }
  }
  
  
  
  // padding:2.4375rem 0 0rem 0;

}
.coupon-info {
  border-radius: 1.125rem;
  background-color: #fff;
  width:100%;
  position: relative;
  flex-direction: column;
  .coupon-img {
    width: 3.375rem;
    height: 3.375rem;
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    top:0%;
    left:50%;
    transform: translate(-50%,-50%);
    img {
      width: 3.25rem;
      height: 3.25rem;
      border-radius: 50%;
    }
  }
  .title {
    width:70%;
    font-size: 0.9375rem;
    color: #00001C;
    font-weight: bold;
    text-align: center;
    padding:2.4375rem 0 0rem 0;
  }
  .coupon-pirce {
    width: 13.8125rem;
    border-radius: 0.9375rem;
    position: relative;
    z-index: 0;
    padding:0.9375rem 0 0.875rem 0;
    margin:1.25rem 0 1.5625rem 0;
    .circle-hide {
      width:1.25rem;
      height: 1.25rem;
      overflow: hidden;
      background-color: #fff;
      z-index: 2;
      position: absolute;
      top:41%;
      left:-1.2813rem;
    }
    .circle-hide2 {
      width:1.25rem;
      height: 1.25rem;
      overflow: hidden;
      background-color: #fff;
      z-index: 2;
      position: absolute;
      top:41%;
      right:-1.2813rem;
    }
    .code-circle {
      content:'';
      position: absolute;
      width: 0.9375rem;
      height: 0.9375rem;
      background-color: #ffff;
      border-radius: 50%;
      top:50%;
      z-index: 1;
      left:-0.3438rem;
      transform: translate(0%,-50%);
      // overflow: hidden;
      &::after {
        content: '';
        width: 100%;
        height: 100%;
        border: 0.0625rem solid var(--themeBaseColor);
        opacity: 0.5;
        left:0;
        top:0;
        border-radius: 50%;
        // border-radius: 0 50% 50% 0;
        position: absolute;
      }
    }
    .code-circle2 {
      content:'';
      position: absolute;
      width: 0.9375rem;
      height: 0.9375rem;
      background-color: #ffff;
      border-radius: 50%;
      top:50%;
      z-index: 1;
      right:-0.3438rem;
      transform: translate(0%,-50%);
      &::after {
        content: '';
        width: 100%;
        height: 100%;
        border: 0.0625rem solid var(--themeBaseColor);
        opacity: 0.5;
        left:0;
        top:0;
        border-radius: 50%;
        position: absolute;
      }
    }
    &::after {
      content: '';
      width: 100%;
      height: 100%;
      border: 0.0625rem solid var(--themeBaseColor);
      opacity: 0.5;
      left:0;
      top:0;
      border-radius: 0.9375rem;
      position: absolute;
    }
    
    .price-bg {
      width: 100%;
      height: 100%;
      border-radius: 0.9375rem;
      background-color: var(--themeBaseColor);
      opacity: 0.08;
      position: absolute;
      top:0;
      left:0;
      
    }
    .price {
      font-weight: bold;
      color:  var(--themeBaseColor);
      font-size: 1.875rem;
      line-height: 1.875rem;
      span {
        font-size:1.25rem;
      }
      padding:0 0 0.25rem 0;
    }
    p {
      color:  var(--themeBaseColor);
      font-size: 0.75rem;
    }
  }
  .discount-box {
    height: 3.125rem;
    box-sizing: border-box;
  }
  .coupon-btn {
    margin:1.5625rem 0 1.625rem  0;
    width: 14.1875rem;
    background: var(--themeBaseColor);
    border-radius: 1.25rem;
    font-weight: 500;
    color: #FFFFFF;
    font-size: 0.9375rem;
    line-height: 0.9375rem;
    padding:0.75rem 0 ; 
  }
  .code-desc {
    width:100%;
    position: relative;
    .desc-circle {
      width: 0.9375rem;
      height: 0.9375rem;
      background-color: #F5F5F5;
      border-radius: 50%;
      position: absolute;
      top:0;
      left:0;
      transform: translate(-50%,-50%);
    }
    .desc-circle2 {
      width: 0.9375rem;
      height: 0.9375rem;
      background-color: #F5F5F5;
      border-radius: 50%;
      position: absolute;
      top:0;
      right:0;
      transform: translate(50%,-50%);
    }
    .desc-content {
      border-top:0.0625rem dashed #D6D6DC;
      padding:1.25rem 0 0.9375rem 0;
      margin:0 0.75rem;
      color: #6E6E79;
      line-height: 1.125rem;
      font-size: 0.75rem;
      text-align: left; 
    }
  }
}
</style>